home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
trashcan.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
1KB
|
55 lines
-- trashcan state machine
beginStateMachine()
onEnter(function(msg)
local fillLevel = retrieveData("fillLevel", 0.0);
storeData("fillLevel", fillLevel);
local stink = findChildGO("stink");
stink.setEmitRate(0.0);
end )
onMsg("buildMenu", function(msg)
if (repairMenu()) then return end
-- build the pie menu
clearPieMenu();
local button = addPieMenuButton("pm_bringOutTrash", "takeTrash");
button.addDescription(ACTIVITY, "takeTrash");
button.addDescription(ACTIVITY, "improveTrashTidiness");
button.addIcon("guiIconWohnung");
end )
--
onMsg("takeTrash", function(msg)
-- get the game object server
local gameObjectServer = getGameObjectServer();
-- get character who initiated this action
local character = getStateObjectFromID(msg.sender);
-- walk to the closest action point
local actionPoint = character.getClosestFreeActionPoint(character, this, {"take1", "take2", "take3", "take4",
"take5", "take6", "take7", "take8"});
if (actionPoint) then
-- get the walk state object
local wso = character.walkSO;
if (wso.walkToActionPoint(actionPoint)) then
wso.queueStateMachine("trashcanChar.takeTrash", this);
else
print("no path found");
instantAbort(character, EMOTICON_NOPATH, "emoThink")
end
else
print("no action point found");
instantAbort(character, EMOTICON_CANNOT, "emoThink")
end
end )
endStateMachine()